<!DOCTYPE HTML>
<html lang="zh-cn">
<head>
	<meta charset="UTF-8">
	<title></title>
</head>
<body>

	<script type="text/javascript" src="./crypto-js.js"></script>
	<script type="text/javascript">
		//AES加密，解密
		function Encrypt(word) {
			var key = CryptoJS.enc.Utf8.parse("");
			var srcs = CryptoJS.enc.Utf8.parse(word);
			var encrypted = CryptoJS.AES.encrypt(srcs, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 });
			return encrypted.toString();
		}

		function Decrypt(word) {
			var key = CryptoJS.enc.Utf8.parse("");
			var decrypt = CryptoJS.AES.decrypt(word, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 });
			return CryptoJS.enc.Utf8.stringify(decrypt).toString();
		}
		var keywords="xyu";
		var enkey=Encrypt(keywords);
		alert(Encrypt(keywords));
		alert(Decrypt(enkey)) 
	</script>
</body>
</html>